<template>
  <div class="upload-file">
    <el-upload
      :drag="tag === 'card'"
      :disabled="disabled"
      :auto-upload="autoUpload"
      :action="action"
      :accept="accept"
      :name="name"
      :data="data"
      :show-file-list="showFileList"
      :limit="limit"
      :multiple="multiple"
    >
      <el-button
        v-if="tag === 'button'"
        type="primary"
        :icon="iconName"
      >{{ title || '点击上传' }}</el-button>
      <div v-else>
        <icon
          class="el-icon--upload"
          :name="iconName"
          :size="iconSize"
          :type="iconType"
        />
        <div class="el-upload__text">
          {{ title || '点击上传' }}
        </div>
      </div>
    </el-upload>
  </div>
</template>

<script setup>
import { uploadFileProps } from './props'

const props = defineProps(uploadFileProps)
</script>

<style scoped lang="scss">
:deep(.el-upload-dragger) {
  width: v-bind('props.width');
  height: v-bind('props.height');
  border-radius: v-bind('props.borderRadius');
}
</style>